# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Sheila Aman <sheila@vulpine.house>
# Maintainer: Sheila Aman <sheila@vulpine.house>
pkgname=lynx
pkgver=2.8.9_p1
_relver=${pkgver/_p/rel.}
pkgrel=9
pkgdesc="Cross-platform text-based browser"
url="https://lynx.invisible-island.net/"
arch="all"
license="GPL-2.0-only"
depends="gzip"
makedepends="openssl-dev>3 gettext zlib-dev glib-dev perl ncurses-dev"
subpackages="$pkgname-doc $pkgname-lang"
source="http://invisible-mirror.net/archives/lynx/tarballs/lynx$_relver.tar.bz2
	CVE-2021-38165.patch"
builddir="$srcdir"/$pkgname$_relver

# secfixes:
#   2.8.9_p1-r3:
#     - CVE-2021-38165

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-ipv6 \
		--with-ssl \
		--enable-default-colors \
		--with-screen=ncursesw \
		--with-zlib \
		--disable-full-paths \
		--enable-externs \
		--enable-nls
	make helpdir=/usr/share/doc/lynx/help \
		docdir=/usr/share/doc/lynx
}

check() {
	./lynx -version
}

package() {
	make DESTDIR="$pkgdir" install install-help install-doc \
		helpdir=/usr/share/doc/lynx/help \
		docdir=/usr/share/doc/lynx
}

sha512sums="
61edbe082684fcbd91bdbf4f4d27c3baf92358811aaffc2f8af46adf23ca7b48aede1520fc5f2a8fc974a2f4bbf4e57e7e6027a187bfc6101e56878c98178e6d  lynx2.8.9rel.1.tar.bz2
b68d9f3a89c1e09a13c5d8cc3769fb7e6fe86cce83c4c9000f90425a925b50ff62c14ca52330777d3e94c292a0dca6b5fedc7193030e276f376d91da42b030c5  CVE-2021-38165.patch
"
